package com.hairline.controller;

import com.hairline.bean.User;
import com.hairline.bean.bo.FeedbackBO;
import com.hairline.bean.vo.BaseRespVo;
import com.hairline.service.WxFeedbackService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/feedback")
public class WxFeedbackController {

    @Autowired
    WxFeedbackService wxFeedbackService;

    @RequestMapping("submit")
    public BaseRespVo feedbackSubmit(@RequestBody FeedbackBO feedbackBO) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipals().getPrimaryPrincipal();
        wxFeedbackService.feedbackSubmit(feedbackBO, user);
        return BaseRespVo.ok();
    }
}
